//
//  GitfTableViewCell.m
//  Molian
//
//  Created by xiaocankeji on 15/8/11.
//  Copyright (c) 2015年 xiaocan. All rights reserved.
//

#import "GiftTableViewCell.h"

@implementation GiftTableViewCell

- (void)awakeFromNib {
    // Initialization code
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        CGFloat CellHeight = 84;
        CGFloat Cellwidth = DeviceWidth;
       
        UIImageView *backgroundImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, DeviceWidth, 84)];
        backgroundImageView.image = [UIImage imageNamed:@"giftCellImage"];
        backgroundImageView.userInteractionEnabled = YES;
        self.backgroundView = backgroundImageView;
        //礼物头像
        self.giftAvatarImg = [[UIImageView alloc]init];
        self.giftAvatarImg.frame = CGRectMake(8, (CellHeight-65)/2, 65, 65);
        self.giftAvatarImg.layer.masksToBounds = YES;//开启圆角
        [self.giftAvatarImg.layer setCornerRadius:4];
        [self.giftAvatarImg setContentMode:UIViewContentModeScaleAspectFill];
        [self.topContentView addSubview:self.giftAvatarImg];
        //礼物名字
        self.giftNameLabel = [[UILabel alloc]initWithFrame:CGRectMake(78, 16, DeviceWidth-134, 24)];
        [self labelStyle:self.giftNameLabel];
        self.giftNameLabel.textColor = RGBA(51, 51, 51, 1);
        self.giftNameLabel.font = [UIFont fontWithName:FontName size:16];
        [self.topContentView addSubview:self.giftNameLabel];
        //礼物的价格
        self.priceLabel = [[UILabel alloc]initWithFrame:CGRectMake(DeviceWidth-100, 16, 85, 24)];
        self.priceLabel.textColor = APPCOLOR(1);
        self.priceLabel.font = [UIFont fontWithName:FontName size:16];
        self.priceLabel.textAlignment = NSTextAlignmentRight;
        [self.topContentView addSubview:self.priceLabel];
        //礼物说明
        self.giftSignatureLabel = [[UILabel alloc]initWithFrame: CGRectMake(78, 44, Cellwidth-86, 20)];
        [self labelStyle:self.giftSignatureLabel];
        self.giftSignatureLabel.textColor = RGBA(51, 51, 51, 1);
        self.giftSignatureLabel.font = [UIFont fontWithName:FontName size:16];
        [self.topContentView addSubview:self.giftSignatureLabel];
        
        
    }
    return self;
}
-(UILabel *)labelStyle:(UILabel *)label//统一风格
{
    label.textColor = [UIColor blackColor];
    label.textAlignment = NSTextAlignmentLeft;
    label.font = [UIFont fontWithName:FontName size:10];
    return label;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
